全部文档

北向API服务接口

本文档为边缘市场北向API应用(open_api)的接口文档。 此应用为官方应用,用户可以直接部署到指定边缘节点。部署时不需要用户填写数据库地址,用户名,密码等参数。

使用方式

具体API接口如下:

1.设备数据查询

功能描述:查询在边缘节点子设备中指定设备上传的(历史)数据。返回数据列表和数据数量。

GET /api/v1/data/device/{deviceId}

Query:

Name Description Required Type marks
start 开始时间(毫秒级时间戳) No long
end 结束时间(毫秒级时间戳) No long
currentPage 页码 Yes int
pageSize 每页显示数据条数 Yes int
name 设备属性名称 No string

Response:

{
    "code": 0,
    "msg": "",
    "data": {
        "content": [
            {
                "eventId": "991466b0-6d03-4508-88d6-2dc86e7fc618",   //eventId研发自行定义
                "deviceId": "22",
                "productId": "17",
                "protocol": "MQTT-STANDARD",
                "name": "test",
                "value": 60,
                "created": 1552040792038
            }
        ],
        "totalCount": 45
    }
}

2.子设备命令下发

2.1 MQTT子设备的读,写命令的下发功能,返回命令执行的结果。

注:需要设备在线。

POST /api/v1/command/mqtt

Query:

Body:

Name Type Description Required
deviceId int 设备ID Yes
productId int 产品ID Yes
functionType string 命令类型,可选值propertyGet/propertySet Yes
identifier string 属性名 Yes
identifierValue object 属性值,functionType值为propertySet时必需,值类型:String/Integer/Long/Float/Double/Boolean/Date/Bytes No

body example

{
    "productId": 2,
    "deviceId": 674,
    "functionType": "propertySet",
    "identifier": "tempratrue",
    "identifierValue": 30
}

Response:

{
    "code": 0,
    "msg": "succeed"
}

2.2 Modbus子设备下发命令读取/写入功能点属性信息。

功能描述:提供对子modbus设备的读,写命令的下发功能,通过网关设备进行数据的上传和下发,返回命令执行的结 果。

注:需要设备绑定到网关设备,并且网关设备在线。

POST /api/v1/command/modbus

Query:

Body:

Name Type Description Required
deviceId int 设备ID Yes
productId int 产品ID Yes
functionType string 命令类型,可选值propertyGet/propertySet Yes
identifier string 属性名 Yes
identifierValue object 属性值,functionType值为propertySet时必需,值类型:String/Integer/Long/Float/Double/Boolean/Date/Bytes No

body example

{
    "deviceId": 674,
    "productId": 23,
    "functionType": "propertyGet",
    "identifier": "tempratrue"
}

Response:

{
    "code": 0,
    "msg": "",
    "data": {
        "eventId": "1d90124d-1963-41e7-a1f5-4426f5225c98",
        "productId": 16,
        "deviceId": 44,
        "identifier": "tempratrue",
        "identifierValue": 123
    }
}
  1. 3 OPCUA子设备下发命令读取/写入功能点属性信息。

功能描述:添加一条OPCUA设备在线异步命令

POST /api/v1/command/opcua

Query:

Body:

Name Type Description Required
deviceId int 设备ID Yes
productId int 产品ID Yes
functionType string 命令类型,可选值propertyGet/propertySet Yes
identifier string 属性名 Yes
identifierValue object 属性值,functionType值为propertySet时必需,值类型:String/Integer/Long/Float/Double/Boolean/Date/Bytes No

body example

{
    "deviceId": 674,
    "productId": 23,
    "functionType": "propertySet",
    "identifier": "tempratrue",
    "identifierValue": 30
}

Response:

{
    "code": 0,
    "msg": "succeed"
}

results matching ""

    No results matching ""